package com.curluin.inputInterpretation;

import android.hardware.SensorEvent;

public class SpinEvent {

	float angularSpeedAroundX = 0, angularSpeedAroundY = 0, angularSpeedAroundZ = 0;
	float timeStamp = -1;
	
	public SpinEvent(){}
	
	public SpinEvent(SensorEvent sensorEvent) {
		copyFrom(sensorEvent);
	}
	
	public SpinEvent(float angularSpeedAroundX, float angularSpeedAroundY, float angularSpeedAroundZ, long timeStamp) {
		this.angularSpeedAroundX = angularSpeedAroundX;
		this.angularSpeedAroundY = angularSpeedAroundY;
		this.angularSpeedAroundZ = angularSpeedAroundZ;
		this.timeStamp = timeStamp;
	}
	
	public void copyFrom(SensorEvent sensorEvent){
		float PiF=(float)Math.PI;
		this.angularSpeedAroundX = sensorEvent.values[0] /PiF* 180;
		this.angularSpeedAroundY = sensorEvent.values[1] /PiF * 180;
		this.angularSpeedAroundZ = sensorEvent.values[2] /PiF * 180;
		this.timeStamp = sensorEvent.timestamp;
	}

}
